Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lightningcss

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightningcss

A CSS parser, transformer, and minifier written in Rust

  • 1.28.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
decreased by-7.99%
Maintainers
1
Weekly downloads
 
Created

What is lightningcss?

LightningCSS is a high-performance CSS parser, transformer, and minifier. It is designed to handle large CSS files efficiently and provides various functionalities for CSS processing.

What are lightningcss's main functionalities?

CSS Parsing

This feature allows you to parse CSS strings into an Abstract Syntax Tree (AST). The code sample demonstrates how to parse a simple CSS string and log the resulting AST.

const { parse } = require('lightningcss');
const css = '.class { color: red; }';
const ast = parse(css);
console.log(ast);

CSS Minification

This feature enables you to minify CSS code, reducing its size for better performance. The code sample shows how to minify a CSS string and log the minified output.

const { minify } = require('lightningcss');
const css = '.class { color: red; }';
const minified = minify(css);
console.log(minified);

CSS Transformation

This feature allows you to transform CSS code based on specific targets, such as browser compatibility. The code sample demonstrates transforming a CSS string to be compatible with the specified browser targets.

const { transform } = require('lightningcss');
const css = '.class { color: red; }';
const transformed = transform(css, { targets: { browsers: ['> 1%', 'last 2 versions'] } });
console.log(transformed);

Other packages similar to lightningcss

FAQs

Package last updated on 25 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc